/*
 * Niiuzu
 * Copyright (C) 2011  Thierry Nowak
 * 
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 * details.
 * 
 * You should have received a copy of the GNU General Public License along with
 * this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package com.niiuzu.client.eventbus;

import com.mvp4g.client.annotation.Event;
import com.mvp4g.client.annotation.Events;
import com.mvp4g.client.event.EventBus;
import com.niiuzu.client.module.AuthentificationModule;
import com.niiuzu.client.screen.authentification.login.LogInPresenter;
import com.niiuzu.client.screen.authentification.login.LogInViewImpl;
import com.niiuzu.client.screen.authentification.lost.password.LostPasswordPresenter;
import com.niiuzu.client.screen.authentification.signup.SignUpPresenter;
import com.niiuzu.client.util.LoadingTicket;

/**
 * EventBus regroupant les événements destinés à l'authentification d'un
 * utilisateur.
 */
@Events(startView = LogInViewImpl.class, module = AuthentificationModule.class)
public interface AuthentificationEventBus extends EventBus, CommonEventBus {

	/**
	 * L'utilisateur souhaite accédé au formulaire de connexion.
	 * 
	 * @see LogInPresenter#onLogInFormWanted()
	 */
	@Event(handlers = LogInPresenter.class)
	void logInFormWanted();

	/**
	 * L'utilisateur souhaite accédé au formulaire de création de compte.
	 * 
	 * @see SignUpPresenter#onSignUpFormWanted()
	 */
	@Event(handlers = SignUpPresenter.class)
	void signUpFormWanted();

	/**
	 * L'utilisateur a perdu son mot de passe.
	 * 
	 * @see LostPasswordPresenter#onUserPasswordHasBeenLost()
	 */
	@Event(handlers = LostPasswordPresenter.class)
	void userPasswordHasBeenLost();

	/**
	 * @see ApplicationEventBus#technicalErrorOccurred(Throwable)
	 */
	@Event(forwardToParent = true)
	void technicalErrorOccurred(Throwable caught);

	/**
	 * @see ApplicationEventBus#businessErrorOccurred(String)
	 */
	@Event(forwardToParent = true)
	void businessErrorOccurred(String errorMessage);

	/**
	 * @see ApplicationEventBus#loadingStarted(LoadingTicket)
	 */
	@Event(forwardToParent = true)
	void loadingStarted(LoadingTicket ticket);

	/**
	 * @see ApplicationEventBus#loadingFinished(LoadingTicket)
	 */
	@Event(forwardToParent = true)
	void loadingFinished(LoadingTicket ticket);

	/**
	 * @see ApplicationEventBus#userLoggedIn(LoadingTicket)
	 */
	@Event(forwardToParent = true)
	void userLoggedIn(LoadingTicket ticket);

}
